package indi.h.security.signature;

import indi.h.security.Parameters;

public class SVFactoryImp implements SVFactory {
	private SVFactoryConfig<Enum<?>> svFactoryConfig;

	protected SVFactoryImp() {

	}

	public static SVFactory getInstance(Enum<?> e) {
		return getInstance(e, new SVFactoryConfigImp<Enum<?>>());
	}

	public static SVFactory getInstance(Enum<?> e, SVFactoryConfig<Enum<?>> factoryConfig) {
		SVFactoryImp svfi = new SVFactoryImp();
		factoryConfig.init(e);
		svfi.svFactoryConfig = factoryConfig;
		return svfi;
	}

	@Override
	public SV createSV() {
		// TODO Auto-generated method stub
		return createSV(svFactoryConfig.getParameters());
	}

	@Override
	public SV createSV(Parameters parameters) {
		// TODO Auto-generated method stub
		AbstractSV sv = svFactoryConfig.newAbstractSV();
		sv.setParams(parameters);
		sv.init();
		return sv;
	}
}
